package com.lwl.blog.controller;

import com.lwl.blog.core.servlet.BaseServlet;
import com.lwl.blog.service.InvitationService;
import com.lwl.blog.service.impl.InvitationServiceImpl;
import com.lwl.blog.vo.IndexDataVo;

import javax.servlet.annotation.WebServlet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@WebServlet("/IndexServlet/*")
public class IndexServlet extends BaseServlet {
    //调用service层
    private InvitationService invitataionService = new InvitationServiceImpl();

    public void index() throws Exception {
        //1.进入论坛首页
        //2.将首页的信息转发到servlet中
        //3.将servlet获得到的信息转化为json形式 然后传给
        List<IndexDataVo> list = invitataionService.indexDateList();
        //4.将它放到集合中
        Map<String,Object> m=new HashMap<>();
        m.put("indexDateList",list);
        System.out.println("IndexServlet层输出："+list);
        //5.然后转发到视图层处理
        outView("view/index",m);
    }
}
